<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>商家列表</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="../static/common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="../static/common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="../static/common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="../static/css/personal.css" media="all">
</head> 
<body>
<section class="layui-larry-box">

	<form class="form-inline" role="form" action="/bsc/shop/listAll" method="post">
	 <input type="hidden" id="shopid" >
            <blockquote class="layui-elem-quote news_search">
  <div class="form-group">
   店铺编号:
    <input type="text" class="form-control" name="shop_id" id="shop_id" placeholder="请输入店铺编号"  value="${map.shop_id }">
  </div>
   <div class="form-group">
   店铺名称:
    <input type="text" class="form-control" name="shop_name" id="shop_name" placeholder="请输入店铺名称" value="${map.shop_name }">
  </div>
  状态:
  <select class="form-control" name="show_status" id="status">
  <option value="-1">请选择</option>
  <option value="0">停用</option>
  <option value="1">启用</option>
</select> <br>
   <div class="form-group">
   店主帐户:
    <input type="text" class="form-control" name="bsu.account" id="ba" placeholder="请输入店主帐户" value="${map.bsu.account }">
  </div>
    <div class="form-group">
   营业执照号:
    <input type="text" class="form-control" name="shop_license" id="shop_license" placeholder="请输入营业执照号" value="${map.shop_license }">
  </div>
  <button type="submit"   class="btn btn-primary">查询</button>
  <button type="button" class="btn btn-info"  id="bt" >增加</button>
  <button type="button"   class="btn btn-info" onclick="alter()" >查看详情</button>
  <button type="button"  onclick="redact()"  class="btn btn-info">编辑</button>
<button type="button"  onclick="de()"  class="btn btn-info">删除</button>
<button type="button"  onclick="cz()"  class="btn btn-info">重置</button>
  
  
	</blockquote>
            
		         <!-- 操作日志 -->
                <div class="layui-form news_list">
                    <table class="layui-table" >
					    <colgroup>
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="15%">
					</colgroup>
					<thead>
						<tr>
							<th style="text-align:left;">编号</th>
							<th >店铺编号</th>
							<th>店铺名称</th>
							<th>店铺简称</th>
							<th>店主帐户</th>
							<th>店铺法人</th>
							<th>营业执照号</th>
							<th>店铺电话</th>
							<th>状态</th>
						</tr>
					</thead>
					<tbody class="news_content"  id="tb">
						<c:forEach items="${info.list }" var="bs" varStatus="s">
						<tr>
							<td align="left">${s.index+1 }</td>
							<td >${bs.shop_id }</td>
 							<td>${bs.shop_name }</td> 
							<td>${bs.short_name }</td>
							<td>${bs.bsu.account }</td>
							<td>${bs.bsu.username }</td>
							<td>${bs.shop_license }</td>
							<td>${bs.shop_phone }</td>
							<td>
							<c:if test="${bs.show_status=='0'}">禁用</c:if>
							<c:if test="${bs.show_status=='1' }">启用</c:if>
							</td>
						</tr>
						</c:forEach>
					</tbody>
					</table>
                     
		</div>
		<div class="layui-inline">
  <a href="#" class="layui-btn layui-btn-normal" onclick="up()">上一页</a>   <a class="layui-btn layui-btn-normal" href="#" onclick="next()" >下一页</a>
</div>
		
	  </form> 
	

</section>
<script type="text/javascript" src="../static/common/layui/layui.js"></script>
<!-- <script type="text/javascript" src="../static/js/newslist.js"></script> -->
 <script type="text/javascript" src="../static/js/jquery-1.7.1.js"></script> 
<script type="text/javascript" src="../static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<script type="text/javascript">
$(function(){
	  //下拉框定值
	 $("#status").val(${map.show_status}); 
	  //跳转新增页面
	 $("#bt").click(function(){
		   document.forms[0].action="/bsc/shop/insert";
	    	 document.forms[0].submit(); 
	   });  
	 //点击表格变色
	 	$("#tb tr").click(function(){
			$(this).css("background","#DCDCDC").siblings().css("background","white");
			var tdval=$(this).children("td:eq(1)").text();
			$("#shopid").val(tdval)
			})
});
//查看详情	  
function alter(){
	 if($("#shopid").val()==""){
		 alert("选择一个店铺")
	 }else{
		    document.forms[0].action="/bsc/shop/xq?shopid="+$("#shopid").val();
			document.forms[0].submit();
	 }
     
} 	
//编辑
function redact(){
	 if($("#shopid").val()==""){
		 alert("选择一个店铺")
	 }else{
		     document.forms[0].action="/bsc/shop/editshop/"+$("#shopid").val();
			document.forms[0].submit();
	 }
     
}
//删除
function de(){
	 if($("#shopid").val()==""){
		 alert("选择一个店铺")
	 }else{
		  if(window.confirm("你确定删除吗?")){
			  document.forms[0].action="/bsc/shop/deleteshop/"+$("#shopid").val();
				document.forms[0].submit(); 
		  }
	 }
     
}
//上一页
function up(){
	document.forms[0].action="/bsc/shop/listAll?page="+${info.prePage};
	document.forms[0].submit();
};
//下一页
function next(){
	document.forms[0].action="/bsc/shop/listAll?page="+${info.nextPage};
	document.forms[0].submit();
};
function cz(){
	$("#shop_id").val("");
	$("#shop_name").val("");
	$("#status").val("-1");
	$("#ba").val("");
	$("#shop_license").val("");
};
</script>
</body>
</html>